package com.bjpowernode.controllers;

import com.bjpowernode.entities.TProduct;
import com.bjpowernode.result.Result;
import com.bjpowernode.services.ProductService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProductController {
    @Resource
    private ProductService productService;

    @GetMapping(value = "/api/products")
    public Result getProducts() {
        List<TProduct> productList = productService.getProducts();
        return Result.OK(productList);
    }
}
